package com.wyl.dao

import com.wyl.pojo.Blog
import com.wyl.utils.generateID
import com.wyl.utils.getSqlSession
import org.junit.Test
import java.util.*

class BlogMapperTest {
    @Test
    fun testAddBlog() {
        getSqlSession().use {
            val mapper = it.getMapper(BlogMapper::class.java)
            arrayOf(
                Blog(generateID(), "Mybatis", "狂神说", Date(), 999),
                Blog(generateID(), "Java", "狂神说", Date(), 999),
                Blog(generateID(), "Spring", "狂神说", Date(), 999),
                Blog(generateID(), "微服务", "狂神说", Date(), 999)
            ).forEach { blog ->
                mapper.addBlog(blog)
                it.commit()
            }
        }
    }
}